<?php
require 'vendor/autoload.php';
use Medoo\Medoo;
class singletonDB{
    //创建静态私有变量保存对象
    private static $instance;
    //防止使用new直接创建对象
    private function __construct(){}
    //防止使用clone克隆对象
    private function __clone(){}

    public static function getInstance(){
        if(self::$instance == null){
            self::$instance = new Medoo([
                'database_type' => 'mysql',
                'database_name' => 'test',
                'server' => 'localhost',
                'username' => 'root',
                'password' => 'root',
                'charset' => 'utf8',
                // 可选参数
                'port' => 3306,
                // 可选，定义表的前缀
                'prefix' => 'fld_',
            ]);
        }
        return self::$instance;
    }
}